package com.teaut.dota.hider.entity;

import com.teaut.dota.hider.entity.common.AbstractBaseEntity;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Entity
@Setter
@Getter
public class UserEntity extends AbstractBaseEntity {

    private String username;

    private String password;

    private String email;

    private String phone;

    private String address;

    private String city;

    private String state;

    private String zip;

    private String country;

    private String language;

    private String timezone;

    private String template;

    @ManyToMany
    @JoinTable(name = "role_user_rela",// foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT), inverseForeignKey =@ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT),
            joinColumns = {@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))},
            inverseJoinColumns = {@JoinColumn(name = "role_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))}
    )
    public List<RoleEntity> roles;

    @ManyToMany
    @JoinTable(name = "dept_user_rela",// foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT), inverseForeignKey =@ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT),
            joinColumns = {@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))},
            inverseJoinColumns = {@JoinColumn(name = "dept_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))}
    )
    public List<DeptEntity> depts;
}
